﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ParticleSystem;
namespace BGSpaceShooter
{
    class ZombieProjectile : GameObject
    {
        private TimeSpan Timeout = new TimeSpan(0, 0, 0, 0, 5000);
        private TimeSpan FireTimeout = new TimeSpan(0, 0, 0, 0, 2000);

        private IObjectEffect explosionEffect;
        private DateTime creationTime;
        public ZombieProjectile(Projectile parent)
            : base(parent.Model)
        {
            explosionEffect = new FireEffect(this);
            explosionEffect.IsActive = true;
            this.Position = parent.Position;
            creationTime = DateTime.Now;

        }

        public IEnumerable<IObjectEffect> getObjectEffects()
        {
            return new List<IObjectEffect> { explosionEffect };
        }

        public bool checkIfOutdated()
        {
            if (DateTime.Now - creationTime > FireTimeout)
                explosionEffect.IsActive = false;
            if (DateTime.Now - creationTime > Timeout)
                return true;
            else
                return false;
        }
    }
}
